<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>SSE</title>
</head>
<body>
<div id="sse">
<script>
  let eventSource = new EventSource("/sse/end");
  // eventSource.onmessage = function(event){
  //     document.getElementById("sse").innerHTML= event.data;
  // }
  eventSource.addEventListener("foo",(event)=>{
    document.getElementById("sse").innerHTML= event.data;
  });

  eventSource.addEventListener("end",(event)=>{
    eventSource.close();
  });
</script>
</div>
</body>
</html>